/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.evans.springcloud.consumer.dept.controller;

import com.evans.api.service.DeptClientService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author wangsunjie
 */
@RestController
@Controller("/feign")
public class FeignDeptConsumerController {
    
    @Autowired
    private DeptClientService deptClientService;
    
    
    @PostMapping("/consumer/dept/add")
    public boolean add(String dept) {
        return this.deptClientService.add(dept);
    }
    
    @GetMapping(value = "/consumer/dept/get/{id}")
    public String get(@PathVariable("id") Long id) {
        return this.deptClientService.queryById(id);
    }
    
    @GetMapping("/consumer/dept/list")
    public List<String> list() {
        return this.deptClientService.queryAll();
    }
    
    
    
}
